<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>掌上中考</title>
        <!-- CSS文件 -->
        <link rel="stylesheet" href="resources/css/app.css" type="text/css" />
        <link rel="stylesheet" href="resources/css/style.css" type="text/css" />
        <!-- JS文件 -->
        <script type="text/javascript" src="sencha-touch-all.js"></script>
        <script type="text/javascript" src="app.js"></script>
		<script type="text/javascript" src="phonegap.js"></script>
        <script type="text/javascript" charset="utf-8">
            document.addEventListener("deviceready", onDeviceReady, false); // PhoneGap加载完毕     
            function onDeviceReady() {         
				//按钮事件        
            	checkConnection();         
				document.addEventListener("backbutton", eventBackButton, false); //返回键         
             	document.addEventListener("menubutton", eventMenuButton, false); //菜单键       
			 	document.addEventListener("searchbutton", eventSearchButton, false); //搜索键      
			}     
			function onConfirm(button) {           
				if (button == '1') {               
					navigator.app.exitApp();         
				} else {}      
			}     
			//返回键    
		 	function eventBackButton() {
				navigator.notification.confirm('确定退出掌上中考？', // 显示信息        
				onConfirm, // 按下按钮后触发的回调函数，返回按下按钮的索引         
				'退出应用', // 标题         
				'确定,取消' // 按钮标签         
				);       
			}     
			//菜单键    
			function eventMenuButton() {         
				//alert('点击了 菜单 按钮!');     
			}       
			//搜索键     
			function eventSearchButton() {           
				//window.plugins.ToastPlugin.show_short('点击了 搜索 按钮!');     
			}           
			function checkConnection() {          
				var networkState = navigator.network.connection.type;                   
				var states = {};          
				states[Connection.UNKNOWN]  = 'Unknown connection';          
				states[Connection.ETHERNET] = 'Ethernet connection';          
				states[Connection.WIFI]     = 'WiFi connection';          
				states[Connection.CELL_2G]  = 'Cell 2G connection';          
				states[Connection.CELL_3G]  = 'Cell 3G connection';          
				states[Connection.CELL_4G]  = 'Cell 4G connection';          
				states[Connection.NONE]     = 'No network connection';          
				//alert(states[networkState]);         
				if(states[networkState]=='No network connection'||typeof states[networkState] == "undefined"){    
					Ext.Msg.alert('提示', '应用需要连接网络获得数据，请打开网络.');      
				}     
			}; 
        </script>
    </head>
    <body>
    </body>
</html>
